<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function show(){
				var $uid=uid.value;
				var $uname=uname.value;
				var $upwd=upwd.value;
				var $email=email.value;
				var $gender=gender.value;
				var $phone=phone.value;
				if(!$uid){alert("请输入id");return}
				if(!$uname){alert("请输入用户名");return}
				if(!$upwd){alert("请输入密码");return}
				if(!$email){alert("请输入邮箱");return}
				if(!$gender){alert("请输入性别");return}
				if(!$phone){alert("请输入电话");return}
				var xhr=new XMLHttpRequest();
				xhr.onreadystatechange=function(){
					if(xhr.readyState==4 && xhr.status==200){
						var r=xhr.responseText;
						d1.innerHTML=r;
					}
				}
				xhr.open("put","/pro/v1/update",true);
				  var formdata=`uid=${$uid}&uname=${$uname}&upwd=${$upwd}&email=${$email}&gender=${$gender}&phone=${$phone}`;
					xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				xhr.send(formdata);
			}
		</script>
	</head>
	<body>
		<h1>修改用户</h1>
		编号<input type="text" id="uid"><br>
		账户<input type="text" id="uname"><br>
		密码<input type="text" id="upwd"><br>
		邮箱<input type="text" id="email"><br>
		性别 <input type="text" id="gender"><br>
		电话<input type="text" id="phone"><br>
		<button onclick="show()">修改用户</button>
		<div id="d1">
			
		</div>
	</body>
</html>
